home *** CD-ROM | disk | FTP | other *** search
/ internet.au CDrom 42 / NETCD42.iso / web / w95 / dream2.exe / data1.cab / Program_Files / Configuration / Behaviors / Actions / Display Status Message.js < prev    next >
Encoding:
JavaScript  |  1998-11-30  |  2.2 KB  |  86 lines

  1. // Copyright 1998 Macromedia, Inc. All rights reserved.
  2.  
  3. //*************** GLOBALS VARS *****************
  4.  
  5. //******************* BEHAVIOR FUNCTION **********************
  6.  
  7. //Displays a message in the status bar at the bottom of the
  8. //browser window. Passed the following arg:
  9. //  msgStr - a string
  10. //
  11. //This simple function, passed a string, sets the status property.
  12. //This is especially useful for having links display a help message when
  13. //the mouse is over them. Normally, links display the HREF value, unless
  14. //we return "true". Because we could have many actions to a single event,
  15. //here we set a global return value, which gets returned after all
  16. //Action function calls, with an inserted "return(document.MM_returnValue)".
  17.  
  18. function MM_displayStatusMsg(msgStr) { //v2.0
  19.   status=msgStr;
  20.   document.MM_returnValue = true;
  21. }
  22.  
  23.  
  24. //******************* API **********************
  25.  
  26.  
  27. //Can be used with any tag and any event
  28.  
  29. function canAcceptBehavior(){
  30.   return true;
  31. }
  32.  
  33.  
  34.  
  35. //Returns a Javascript function to be inserted in HTML head with script tags.
  36.  
  37. function behaviorFunction(){
  38.   return "MM_displayStatusMsg";
  39. }
  40.  
  41.  
  42.  
  43. //Returns fn call to insert in HTML tag <TAG... onEvent='thisFn(arg)'>
  44. //Calls escQuotes to find embedded quotes and precede them with \
  45.  
  46. function applyBehavior() {
  47.   var msgStr = escQuotes(document.theForm.message.value);
  48.   if (msgStr == '') {
  49.     return MSG_NoMsg;
  50.   } else {
  51.     return "MM_displayStatusMsg('" + msgStr + "')";
  52.   }
  53. }
  54.  
  55.  
  56.  
  57. //Passed the function call above, takes prior arguments and reloads the UI.
  58. //Removes any escape characters \
  59.  
  60. function inspectBehavior(msgStr){
  61.   var startStr = msgStr.indexOf("'") + 1;
  62.   var endStr = msgStr.lastIndexOf("'");
  63.   if (startStr > 0 && endStr > startStr) {
  64.     document.theForm.message.value = unescQuotes(msgStr.substring(startStr,endStr));
  65.   }
  66. }
  67.  
  68.  
  69.  
  70. //***************** LOCAL FUNCTIONS  ******************
  71.  
  72.  
  73. //Set the insertion point
  74.  
  75. function initializeUI(){
  76.   document.theForm.message.focus(); //set focus on textbox
  77.   document.theForm.message.select(); //set insertion point into textbox
  78. }
  79.  
  80.  
  81.  
  82. //**************** GENERIC FUNCTIONS ****************
  83.  
  84. //function escQuotes(theStr){
  85. //function unescQuotes(theStr){
  86.